/**
 * Created by Administrator on 2017/4/19.
 */
window.onload=function(){
    var H=null;
     // H=$("#qbt-banner-pic").children("div.pic-box").eq(0).height();
     // $("#qbt-banner").height(H);
     // $(window).resize(function(){
     // H=$("#qbt-banner-pic").children("div.pic-box").eq(0).height();
     // $("#qbt-banner").height(H);
     // });
    /*banner轮播*/
    var ind=0;
    var timer=null;
    var wid="36px";
    var wid2="13px";
    var hie="13px";

    $(window).resize(function(){
        if($(window).width()<=450){
            wid="16px";
            wid2="8px";
            hie="8px"
        }else {
            wid="36px";
            wid2="13px";
            hie="13px";
        };
    });
    if($(window).width()<=450){
        wid="16px";
        wid2="8px";
        hie="8px";
    }else {
        wid="36px";
        wid2="13px";
        hie="13px";
    };
    $("#pbt-banner-but").find("li").click(function(){
        ind=$(this).index();
        carousel()
    });
    run();
    $("#qbt-banner-pic").children("div.pic-box").hover(function(){
        clearInterval(timer)
    },function(){
        run();
    });
    $("#pbt-banner-but").find("li").hover(function(){
        clearInterval(timer)
    },function(){
        run();
    });
    function carousel(){
        $("#pbt-banner-but").find("li").eq(ind).css({
            "background-color": "#fff"
        }).stop().animate({
            "width": wid,
            "height":hie
        },800).siblings().css({
            "background-color": "#8292bf"
        }).stop().animate({
            "width": wid2,
            "height":hie
        },800);
        $("#qbt-banner-pic").children("div.pic-box").eq(ind).stop().animate({
            "opacity":1,
            "filter": "Alpha(opacity=100)"
        },800).siblings().stop().animate({
            "opacity":0,
            "filter": "Alpha(opacity=0)"
        },800);
    };
    function run(){
        timer=setInterval(function(){
            ind++;
            if(ind>2){
                ind=0;
            }
            carousel()
        },4000)
    }
    /*banner轮播 end*/
};